package mytest;

public class Clockwise_Square {

	static int x1,y1,x2,y2;
	
	static void solve(int m,int n)
	{
		int not=0,dir=1,ub=0,db=n-1,lb=0,rb=m-1;
		int cx=0,cy=0;
		while(not!=2)
		{
			//if(not==0)System.out.println("("+cx+","+cy+")");
			int lx=cx,ly=cy;
			switch(dir){
			case 1:cx++;break;
			case 2:cy++;break;
			case 3:cx--;break;
			case 4:cy--;break;
			}
			if(cx>=lb&&cx<=rb&&cy>=ub&&cy<=db)
			{
				not=0;
			}else{
				not++;
				cx=lx;
				cy=ly;
				dir=(dir+1)%4;
				if(dir==0)dir=4;
				switch(dir)
				{
				case 1:lb++;break;
				case 2:ub++;break;
				case 3:rb--;break;
				case 4:db--;break;
				}
			}
		}
		x1=cx;
		y1=cy;
	}
	
	static void getLast(int m,int n)
	{
		
		if(m>n)
		{
			if(n%2==0)
			{
				//System.out.println((n/2-1)+","+n/2);
				x2=n/2-1;
				y2=n/2;
			}else{
				//System.out.println((m-n/2-1)+","+n/2);
				x2=m-n/2-1;
				y2=n/2;
			}
		}else{
			if(m%2==0)
			{
				//System.out.println((m/2-1)+","+m/2);
				x2=m/2-1;
				y2=m/2;
			}else{
				//System.out.println(m/2+","+(n-m/2-1));
				x2=m/2;
				y2=n-m/2-1;
			}
		}
		
		
//		  int a=Math.min(m, n);
//		  int b=Math.max(m, n);
//		  int tx=a/2+a%2-1;
//		  int ty=((a&1)==1)?(b-a/2-1):(a/2);
//		  
//		  if(tx!=x2||ty!=y2)System.out.println(tx+","+ty+"|"+x2+","+y2+"|"+x1+","+y1);
		
	}
	
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		for(int i=8;i<15;i++)
			for(int j=7;j<51;j++)
			{
				solve(i, j);
				getLast(i, j);
				if(x1!=x2||y1!=y2){
					System.out.println(false);
					return;
				}else{
					//System.out.println(x1+","+y1);
				}
			}
	}

}
